package com.zang.spi;

import com.zang.spi.service.Robot;
import org.junit.Test;

import java.util.ServiceLoader;

/**
 * @author Zhang Qiang
 * @Date 2019/7/18 14:41
 */
public class Action {
    @Test
    public void sayHello(){
        ServiceLoader<Robot> serviceLoader = ServiceLoader.load(Robot.class);
        System.out.println("Java SPI");
        serviceLoader.forEach(Robot::sayHello);
    }

}
